package top.yxqz.spring.ioc.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import top.yxqz.spring.ioc.dao.UserDao;
import top.yxqz.spring.ioc.service.UserService;

/**
 * @author: 余小小
 * @date: 2023/4/6
 * @description：
 * 实现逻辑的地方 Service：将类标 识为业务层组件
 * @Service("userService") 应用场景：一个接口，有多个实现类
 */
@Service("userService2")
public class UserServiceImpl2 implements UserService {
    //    private UserDao userDao  = new UserDaoImpl();
    @Autowired
    private UserDao userDao;

    @Override
    public void sayUserHello() {
        System.out.println("我是UserServiceImpl2");
        userDao.sayUserHello();
    }

    public UserDao getUserDao() {
        return userDao;
    }

    public void setUserDao(UserDao userDao) {
        this.userDao = userDao;
    }
}
